package com.zjzywl.smoke.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/*
 * 设备状态表，存储设备最近一次状态及上报时间
 * 
 * */

@Entity
public class DeviceStatus implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;
	private String devCode;
	@OneToOne
	@JoinColumn(name = "deviceID")
	private Device device;
	private Integer status; // 状态
	@Temporal(TemporalType.TIMESTAMP)
	private Date returnTime; // 上报时间
	private String data; // 原始设备数据串
	private String light; // 光照
	private String temperature; // 红外监测出的温度
	private String voltage; // 红外的电压
	private String space; // 垃圾桶剩余高度
	private String temperature1; // 温湿度检测仪解析出来的温度
	private String humidity; // 温湿度检测仪解析出来的湿度
	private String electricity;//电流大小
	private int fireCount;//火警次数
	public int getFireCount() {
		return fireCount;
	}

	public void setFireCount(int fireCount) {
		this.fireCount = fireCount;
	}

	public String getElectricity() {
		return electricity;
	}

	public void setElectricity(String electricity) {
		this.electricity = electricity;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Device getDevice() {
		return device;
	}

	public void setDevice(Device device) {
		this.device = device;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getReturnTime() {
		return returnTime;
	}

	public void setReturnTime(Date returnTime) {
		this.returnTime = returnTime;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getLight() {
		return light;
	}

	public void setLight(String light) {
		this.light = light;
	}

	public String getTemperature() {
		return temperature;
	}

	public void setTemperature(String temperature) {
		this.temperature = temperature;
	}

	public String getVoltage() {
		return voltage;
	}

	public void setVoltage(String voltage) {
		this.voltage = voltage;
	}

	public String getSpace() {
		return space;
	}

	public void setSpace(String space) {
		this.space = space;
	}

	public String getTemperature1() {
		return temperature1;
	}

	public void setTemperature1(String temperature1) {
		this.temperature1 = temperature1;
	}

	public String getHumidity() {
		return humidity;
	}

	public void setHumidity(String humidity) {
		this.humidity = humidity;
	}

	public String getStatusStr() {
		String statusStr = "normal";
		switch (status) {
		case 1:
			statusStr = "fire";
			break;
		case 2:
			statusStr = "normal";
			break;
		case 3:
			statusStr = "malfunction";
			break;
		case 4:
			statusStr = "lowpower";
			break;
		case 7:
			statusStr = "normal";
			break;
		case 9:
			statusStr = "normal";
			break;
		default:
			break;
		}
		return statusStr;
	}

	public String getDevCode() {
		return devCode;
	}

	public void setDevCode(String devCode) {
		this.devCode = devCode;
	}
}
